package org.lifeaddict.sybill;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;


public class LvEventDate implements Comparable<LvEventDate> {
	private Date date;
	private String location, day, time1, time2, name;
	public LvEventDate(String location, String date, String time1, String time2) {
		String tempDate = date + "--" + time1;
		SimpleDateFormat formatter1 = new SimpleDateFormat("d.M.yyyy--hh:mm", Locale.GERMAN);
		SimpleDateFormat formatter2 = new SimpleDateFormat("EE", Locale.GERMAN);
		try {
			this.date = formatter1.parse(tempDate);
			this.day = formatter2.format(this.date);
		} catch(Exception e) { }
		
		this.time1 = time1;
		this.time2 = time2;
		this.location = location;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getDay() {
		return this.day;
	}
	
	public String getLocation() {
		return this.location;
	}
	
	public String getName() {
		return this.name;
	}
	
	public String getTime() {
		return time1 + " - " + time2;
	}
	
	public String getDate() {
		SimpleDateFormat formatter = new SimpleDateFormat("d.M.yyyy", Locale.GERMAN);
		return formatter.format(this.date);
	}
	
	public Date getDateReal() {
		return date;
	}
	
	public String toString() {
		SimpleDateFormat formatter = new SimpleDateFormat("d.M.yyyy", Locale.GERMAN);
		return "am " + day + " " + formatter.format(date) + " von " + time1 + " bis " + time2 + " im/in " + location;
	}
	
	public int compareTo(LvEventDate that) {
		return this.date.compareTo(that.date);
	}
}
